package com.xyzwps.webfluxjava.dao.repository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.xyzwps.webfluxjava.dao.mapper.IArticleMapper;
import com.xyzwps.webfluxjava.model.Article;

import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;

@Component
public class ArticleRepository {

	@Autowired
	private IArticleMapper articleMapper;
	
	public Mono<Article> getForReading(String uniqId) {
		return Mono.fromCallable(() -> {
			return articleMapper.getForReading(uniqId);
		}).publishOn(Schedulers.elastic());
	}
}
